<form id="formEdit" class="form-horizontal" role="form">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">操作</h4>
            </div>
            <div class="modal-body">
            	<!-- 以下为要修改的的内容 -->
				<input type="hidden" name="id" data-th-value="${model.id}">
				<input type="hidden" name="creator" data-th-value="${model.creator}">
                <div class="form-group">
                	<label for="txt_classId" class="col-sm-2 control-label">班级</label>
                	<div class="col-sm-9">
	                     <select id="txt_classId" class="form-control" name="classId">
	                     	<option data-th-each="bj:${classes}" data-th-value="${bj.id}" data-th-selected="${model.tbClass!=null&&bj.id==model.tbClass.id}"  data-th-text="${bj.name}"></option>
	                     </select>
                	</div>
                </div>
                <div class="form-group">
                	<label class="col-sm-2 control-label" for="txt_name">活动名称</label>
                	<div class=col-sm-9>
                    <input type="text" name="name" data-th-value="${model.name}" class="form-control" id="txt_name" placeholder="活动名称">
                	</div>
                </div>
                <div class="form-group">
                	<label for="txt_manager" class="col-sm-2 control-label">主持人</label>
                	<div class="col-sm-9">
	                    <input type="text" name="manager" data-th-value="${model.manager}" class="form-control" id="txt_manager" placeholder="主持人">
                	</div>
                </div>
                <div class="form-group">
                	<label for="txt_date" class="col-sm-2 control-label">日期</label>
                	<div class="col-sm-9">
	                    <input type="text" name="date" data-th-value="${model.date}" class="form-control" id="txt_date" placeholder="日期">
                	</div>
                </div>
                <div class="form-group">
                	<label for="txt_type" class="col-sm-2 control-label">类型</label>
                	<div class="col-sm-9">
						<select id="txt_type" name="type" class="form-control">
							<option value="0" data-th-selected="${model.type==0}">班级活动</option>
							<option value="1" data-th-selected="${model.type==1}">团支部活动</option>
						</select>
                	</div>
                </div>
                <div class="form-group">
                	<label for="txt_demo" class="col-sm-2 control-label">活动详情</label>
                	<div class="col-sm-9">
		                <textarea rows="4" id="txt_demo" class="col-sm-10 col-sm-1-offset form-control" name="demo" data-th-text="${model.demo}"  placeholder="活动详情"></textarea>
                	</div>
                </div>
                <!-- 以上为要修改的内容 -->
            </div>
            <div class="modal-footer">
                <button type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span>保存</button>
                <button type="button" class="btn btn-default" data-dismiss="modal"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span>关闭</button>
            </div>
        </div>
    </div>
</form>
<script type="text/javascript" th:inline="javascript">
    $(function () {
　　　　 	var options= {
			message: '验证不通过',
			feedbackIcons: {
                 valid: 'glyphicon glyphicon-ok',
                 invalid: 'glyphicon glyphicon-remove',
                 validating: 'glyphicon glyphicon-refresh'
             },
             fields: { 
             	
            	 name: {
    				validators: {
    					notEmpty: {
    						message: '活动名称不能为空'
    					}
    				}
    			},
    			date: {
    				validators: {
    					notEmpty: {
    						message: '日期不能为空'
    					},
						date:{
							format : 'YYYY-MM-DD',
							message:'请输入有效的日期格式:yyyy-MM-dd'
						}

    				}
    			},
    			manager:{
					validators:{
						notEmpty:{
							message:'主持人不能为空'
						}
					}
				}
             }
         };
        $('#formEdit').bootstrapValidator(options).on('success.form.bv', function(e) {
        	e.preventDefault();							   	//很重要没有它则会提交默认表单，不会做下面的ajax表单提交
            var fd = new FormData($("#formEdit")[0]); 
            $.ajax({  
              url: "save",  
              type: "POST",  
              data: fd,  
              processData: false,  // 不处理数据  
              contentType: false,   // 不设置内容类型
              success:function(){
            	  $('#myModal').modal("hide");
              }
            });  
        });
    });
</script>